home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 19 / Mac Magazin and MacEasy Magazine CD - Issue 19.iso / Wissenschaft & Technik / Open Prolog / Samples / Drawing Demo / Draw Trial next >
Text File  |  1993-03-15  |  758b  |  32 lines

  1. trial(W,H,R) :-
  2.     Gt is 40,Gl is 5,Gb is Gt+H,Gr is Gl+W,
  3.     draw(1,rect(Gt,Gl,Gb,Gr),_),
  4.     'system$random'(100,Tm),
  5.     repeat(R),
  6.     'system$random'(8,ColourOrdinal),
  7.     ColourValue is ColourOrdinal-1,
  8.     'system$random'(38,Pattern),
  9.     'system$random'(W,Width),
  10.     'system$random'(H,Height),
  11. Yl is H-Height,
  12.     'system$random'(Yl,Y),
  13. Xl is W-Width,
  14.     'system$random'(Xl,X),
  15.     'system$random'(Tm,Thickness),
  16.     draw(6,size(Thickness,Thickness),_),
  17.     draw(9,colour(ColourValue),_),
  18.     draw(8,pattern(Pattern),_),
  19.     Ri is X+Width,
  20.     B is Y+Height,
  21. 'system$random'(4,ComIndex),
  22. member(ComIndex-Command,[1-4,2-3,3-12]),
  23.     draw(Command,rect(X,Y,Ri,B),_),fail.
  24. trial(_,_,_).
  25.  
  26. member(X,[X|_]).
  27. member(X,[_|R]) :- member(X,R).
  28. repeat(0) :- !,fail.
  29. repeat(X).
  30. repeat(X) :- Y is X-1,repeat(Y).
  31.  
  32.